package com.lemon.smartsafety.ui.activity.safe.data;

import android.os.Bundle;
import android.support.v4.app.Fragment;

import com.lemon.smartsafety.R;
import com.lemon.smartsafety.app.BundleKey;
import com.lemon.smartsafety.entity.safe.company.CompanyBuildingCheckItemVo;
import com.lemon.smartsafetynew.ui.activity.base.BaseFragmentActivity;
import com.lemon.smartsafety.ui.fragment.safe.data.BuildingCheckItemFlowListFragment;
import com.lemon.smartsafety.utils.common.LoggerHelper;
import com.lemon.smartsafety.utils.common.StringUtils;

/**
 * Created by Cooliean on 16/1/24.
 * 安全巡查 检查项目 检查流程查看
 */
public class BuildingCheckItemFlowListActivity extends BaseFragmentActivity {
    private LoggerHelper loggerHelper = new LoggerHelper(BuildingCheckItemFlowListActivity.class);

    private BuildingCheckItemFlowListFragment mFragment;

    /**
     * bundle info
     */
    private CompanyBuildingCheckItemVo mCompanyBuildingCheckItemVo;

    @Override
    protected void getBundleArgs() {
        super.getBundleArgs();
        if (getIntent().getExtras() != null) {
            mCompanyBuildingCheckItemVo = (CompanyBuildingCheckItemVo) getIntent().getSerializableExtra(BundleKey.COMPANY_BUILDING_CHECK_ITEM_VO);
        }
    }

    @Override
    protected void initViews() {
        super.initViews();

        if (null != mCompanyBuildingCheckItemVo) {
            String title = String.format(getString(R.string.build_check_item_view_flow), StringUtils.nullValue(mCompanyBuildingCheckItemVo.getObjectTitle()));
            setBarTitle(title);
        }
    }

    @Override
    public Fragment getFragment() {
        return getFragment(null);
    }


    public Fragment getFragment(String text) {
        Bundle bundle = new Bundle();
        bundle.putSerializable(BundleKey.COMPANY_BUILDING_CHECK_ITEM_VO, mCompanyBuildingCheckItemVo);
        mFragment = BuildingCheckItemFlowListFragment.newInstance();
        mFragment.setArguments(bundle);
        return mFragment;
    }

    @Override
    protected void initTitle() {
        this.setBarTitle(R.string.build_prop_type_list);
    }

}
